int turn(char* ss);

int main()
{
	FILE* fp = fopen("string.in", "r");
	FILE* fc = fopen("string.out", "w");

	char* s = nullptr;
	char buff[2048];
	fgets(buff, 2044, fp);
	for (int i = 0; i < 2044; i++)
	{
		if( buff[i]!='{') fprintf(fc,"%c", buff[i]);
		else
		{
			char buff2[128];
			for (int c = 0; c < 128; c++)
			{
				if(buff[i+c]!='}') buff2[c] = buff[i+c];
				else if(buff[i + c]!=' '&& buff[i + c] != '{')
				{
					fprintf(fc, "0x%c", turn(buff2));
					i += c;
					break;
				}
			}
		}
		if (buff[i] == '.')break;
	}

	fclose(fp);
	fclose(fc);

	return 0;
}

int turn(char* ss)
{
	int sum = 0;
	// 十进制换十六进制 传入的是ascii码
	for (int i = 0; i < strlen(ss); i++)
	{
		if (ss[i] >= '0' && ss[i] <= '9') sum += (ss[i] - '0') * pow(16, strlen(ss) - i - 1);
		else if (ss[i] >= 'a' && ss[i] <= 'f') sum += (ss[i] - 'a' + 10) * pow(16, strlen(ss) - i - 1);
		else if (ss[i] >= 'A' && ss[i] <= 'F') sum += (ss[i] - 'A' + 10) * pow(16, strlen(ss) - i - 1);
	}

	return sum;
}